package com.hjy.common.free;

import io.swagger.annotations.ApiModel;
import lombok.Data;

@Data
@ApiModel("响应实体类")
public class DemoResponseBody<T> {
    private int code;
    private String message;
    private T data;

    public DemoResponseBody() {}

    public DemoResponseBody(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public DemoResponseBody(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> DemoResponseBody<T> success(T data) {
        return new DemoResponseBody<>(200, "success", data);
    }

    public static <T> DemoResponseBody<T> error(int code, String message) {
        return new DemoResponseBody<>(code, message, null);
    }



}
